home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tegl6b.zip / INTROPAK.EXE / lha / TEGLMENU.DOC < prev    next >
Text File  |  1991-08-16  |  8KB  |  255 lines

  1. {-----------------------------------------------------------------------------}
  2. {               TEGL Windows ToolKit II                  }
  3. {          Copyright (C) 1990, TEGL Systems Corporation              }
  4. {                All Rights Reserved.                  }
  5. {-----------------------------------------------------------------------------}
  6. {$I switches.inc}
  7. {$V-}
  8.  
  9. Unit TEGLMenu;
  10.  
  11. INTERFACE
  12.  
  13. USES
  14.      teglfont,
  15.      virtmem,
  16.      FastGrph,            {constants eg. JAGGED}
  17.  
  18.      errorlog,
  19.      TEGLSpec,
  20.      TEGLIntr,            {required for mouseposition}
  21.      TEGLUnit;
  22.  
  23. const
  24.    MenuEntryHeight = 3;
  25.    MaxTextStringSize = 40;
  26.  
  27. TYPE
  28.    OptionEPtr  = ^OptionEntry;
  29.    OptionMPtr  = ^OptionMenu;
  30.  
  31.    OMEventPtr  = ^OMEvents;
  32.    OMEvents    = RECORD
  33.             OptionMN       : OptionMptr;
  34.             OptionType       : Byte;
  35.             entrycallproc  : callproc;
  36.             ms           : msclickptr;
  37.          END;
  38.  
  39.    OptionMenu  = RECORD
  40.             NextOM       : OptionMPtr;
  41.             numofentries   : Word;
  42.             maxwidth       : Word;
  43.             displaynum       : word;
  44.             margin       : Word;
  45.             fonttype       : Pointer;
  46.             Proportional   : boolean;
  47.             FirstEntry       : OptionEPtr;
  48.             CurrentEntry   : OptionEPtr;
  49.             CurrentOEnum   : Word;
  50.  
  51.             fs           : imagestkptr;
  52.             ms           : msclickptr;
  53.             x,y,x1,y1       : word;
  54.             slidems       : msclickptr;
  55.             selectedOEnum  : word;
  56.          END;
  57.  
  58.    OptionEntry = RECORD
  59.             NextOE       : OptionEPtr;
  60.             entryline       : String[MaxTextStringSize];
  61.             entryactive    : Boolean;
  62.             entrycolor       : Integer;
  63.             entrycallproc  : callproc;
  64.             entrysubOM       : OptionMPtr;
  65.  
  66.             entryms       : msclickptr;
  67.             entryud       : userrecptr;
  68.             OM           : optionmptr;
  69.  
  70.             entryboolean   : boolean;
  71.             entryvalue       : word;
  72.             entryglobal    : pointer;
  73.          END;
  74.  
  75.  
  76.    MenuConstants = RECORD
  77.               BarMenuMargin     : Word;
  78.               BarMenuColor     : Word;
  79.               BarTextColor     : Word;
  80.               BarBorderColor     : Word;
  81.               BarBorderShow     : Boolean;
  82.               OMSliderWidth     : word;
  83.               OMSliderheight     : word;
  84.               OMInactiveJagged     : Boolean;
  85.               OMSeparatorLine     : word;
  86.               OMMargin         : word;
  87.               OMTabSize      : word;
  88.               OMInactiveColor     : Word;
  89.               OMactiveColor     : Word;
  90.               OMBorderColor     : Word;
  91.               HideSubMenu     : Boolean;
  92.            END;
  93.  
  94. const
  95. {$I teglmenu.inc}
  96. {*------------------------------------------------------------------------*
  97.  |  Menu Constants                              |
  98.  *------------------------------------------------------------------------*}
  99.    MC              : MenuConstants =
  100.                (BarMenuMargin      : 16;
  101.                 BarMenuColor       : 15;
  102.                 BarTextColor       : 0;
  103.                 BarBorderColor     : 15;
  104.                 BarBorderShow      : TRUE;
  105.                 OMSliderWidth      : 12;
  106.                 OMSliderHeight     : 10;
  107.                 OMInactiveJagged   : False;
  108.                 OMSeparatorLine    : $ff;
  109.                 OMMargin           : 10;
  110.                 OMTabSize           : 8;
  111.                 OMInactiveColor    : 7;
  112.                 OMactiveColor      : 0;
  113.                 OMBorderColor      : 0;
  114.                 HideSubmenu        : FALSE
  115.                );
  116.  
  117.    HERC_MC         : MenuConstants =
  118.                (BarMenuMargin      : 16;
  119.                 BarMenuColor       : 15;
  120.                 BarTextColor       : 0;
  121.                 BarBorderColor     : 0;
  122.                 BarBorderShow      : TRUE;
  123.                 OMSliderWidth      : 15;
  124.                 OMSliderHeight     : 12;
  125.                 OMInactiveJagged   : TRUE;
  126.                 OMSeparatorLine    : $ff;
  127.                 OMMargin           : 10;
  128.                 OMTabSize           : 8;
  129.                 OMInactiveColor    : 0;
  130.                 OMactiveColor      : 0;
  131.                 OMBorderColor      : 0;
  132.                 HideSubmenu        : FALSE
  133.                );
  134.  
  135.    AnchorOMPtr          : OptionMPtr  = NIL;
  136.    CurrentOMPtr       : OptionMPtr  = NIL;
  137.  
  138.  
  139. {
  140.    BarMenu Type
  141.    ------------
  142.  
  143.    UpperLeft     ---=======---           UpperRight    ---=======---
  144.             |    |                  |   |
  145.             +---+                  +---+
  146.  
  147.    LowerLeft        +---+           LowerRight      +---+
  148.             |    |                  |   |
  149.          ---=======---                 ---=======---
  150.  
  151.  
  152.    SubMenu Type
  153.    ------------
  154.                                 +---+
  155.    RightTop        +-----+           RightBottom      +-----|   |
  156.             |=====+---+               |=====+---+
  157.             +-----|   |               +-----+
  158.               +---+
  159.                               +---+
  160.    LeftTop        +-----+           LeftBottom     |   |-----+
  161.         +---+=====|                  +---+=====|
  162.         |   |-----+                  +-----+
  163.         +---+
  164. }
  165.    UpperRight             = 0;
  166.    UpperLeft             = 1;
  167.    LowerRight             = 2;
  168.    LowerLeft             = 3;
  169.    RightTop             = 4;
  170.    LeftTop             = 5;
  171.    Rightbottom             = 6;
  172.    Leftbottom             = 7;
  173.    NoToggleEntry         = 8;
  174.    NoToggleExit          = 16;
  175.  
  176.  
  177. {*------------------------------------------------------------------------*
  178.  |  Bar Menu routines                              |
  179.  *------------------------------------------------------------------------*}
  180. Procedure CreateBarMenu(x,y,ln:Word);
  181. Procedure OutBarOption(EntryStr:String; OM:OptionMptr);
  182. Procedure OutBarEvent(EntryStr:String; EntryCallProc:callproc);
  183.       {should define global key click}
  184.  
  185. {*------------------------------------------------------------------------*
  186.  |  Option Menu / Option Entry                          |
  187.  *------------------------------------------------------------------------*}
  188.  
  189. function  GetOMOE(OM:OptionMptr; OENum:word):OptionEptr;
  190. function  GetFSOM(fs:ImageStkPtr):optionmptr;
  191.  
  192. Procedure EntryStatus(OM:OptionMPtr; OENum:Word; status:Boolean);
  193. Procedure OptionText(OM:OptionMPtr; OENum : Word; EntryStr:String);
  194.  
  195. {*------------------------------------------------------------------------*
  196.  |  Option Menu. Basis of Drop down Menus                  |
  197.  *------------------------------------------------------------------------*}
  198. Function  CreateOptionMenu(Fonttype:Pointer) : OptionMPtr;
  199. procedure SetOMDisplaynum(om: Optionmptr; displaynum:word);
  200. procedure SetOMMaxwidth(om: Optionmptr; maxwidth:word);
  201. procedure SetOMMargin(om: Optionmptr; margins:word);
  202. Procedure DefineOptions(OM:OptionMptr; EntryStr:String; Active:Boolean; EntryCallProc:callproc);
  203. Procedure DefineOptionsSub(OM:OptionMptr; EntryStr:String; Active:Boolean; OM2:OptionMptr);
  204. Procedure DefineOptionsRadio(OM:OptionMptr; EntryStr:String; Active:Boolean; EntryCallProc:callproc;
  205.                   Radiovalue:word; VAR RadioVar:word);
  206. Procedure DefineOptionsCheck(OM:OptionMptr; EntryStr:String; Active:Boolean; EntryCallProc:callproc;
  207.                   VAR ChkMark:boolean);
  208. Procedure SetCurrentOEPos(OM:OptionMPtr; OENum:Word);
  209.  
  210. Procedure DropOptionEntry(OM:OptionMPtr; OENum:Word);
  211. Procedure DropOptionMenu(OM:OptionMPtr);
  212.  
  213. {*------------------------------------------------------------------------*
  214.  |  Option Menu Events.                           |
  215.  *------------------------------------------------------------------------*}
  216.  
  217. {should define underscores with connecting keystrokes}
  218. Procedure DefineOptionClickArea(fs:ImageStkPtr; x,y,x1,y1:Word; OM:OptionMPtr; Sense:Boolean; OMType:Byte; Keycode:word);
  219. Procedure DropOptionClickAreas(fs:imagestkptr);
  220.  
  221. {*------------------------------------------------------------------------*
  222.  |  Menu Color Constants                          |
  223.  *------------------------------------------------------------------------*}
  224. Procedure SetOptionMenuColors(activecolor,inactivecolor:Word);
  225. Procedure SetOptionMenuBorderColor(Color:Word);
  226. Procedure SetBarTextColor(Color:Word);
  227. Procedure SetBarMenuMargin(margin:Word);
  228. Procedure SetBarMenuColor(Color:Word);
  229. Procedure SetBarBorderOff;          {Set Bar Border Off}
  230. Procedure SetBarBorderColor(Color:Word);  {set bar border color}
  231. Procedure SetHideSubMenu(on_off:Boolean); {leaves menu on screen}
  232. Procedure SetMenuMargin(pixsize:word);      {default is 10 pixels.. set for checkmarks}
  233. Procedure SetMenuTabsize(charnum:word);   {tabs are |, not $09}
  234. Procedure SetSeparatorLine(mask:word);      {fillpattern, dashed lines are $EE}
  235. Procedure SetInactiveJaggies(on_off:Boolean); {inactive entries on GEM are jagged}
  236. Procedure SetOMSliderSize(width,height:word); {sets slider button width/height}
  237.  
  238. Function  MenuTextWidth(mystr:String):Integer;
  239.              {strlen based on menu interpretation}
  240.  
  241. Procedure OutMenuTextXY(x,y,color:Integer; mystr:String; maxw:word);
  242.              {maxw provides the tail end for right justication}
  243.  
  244. function  OMExists(OM : OptionMPtr) : boolean;
  245.              {checks if it is a valid OM}
  246.  
  247. Function  ScanQuickKey(mystr:String):word;
  248.              {extracts the scan code from a menu string eg. ~A~}
  249.  
  250. Function  OpenOptionMenu(x,y:Word; OM:OptionMPtr) : ImageStkPtr;
  251.              {potential picklist}
  252.  
  253.  
  254. IMPLEMENTATION
  255.